template<typename T>
class Rational
{
public:
	Rational(const T& n=0, const T & d=1)
		: numerator(n), denominator(d) {}
	friend Rational operator*(const Rational &left, const Rational &right) {
		return Rational(left.numerator*right.numerator, left.denominator*right.denominator);
	}
//private:
	T numerator;
	T denominator;
};

/*template<typename T>
Rational<T> operator*(const Rational<T> &left, const Rational<T> &right)
{
	return Rational<T>(left.numerator*right.numerator, left.denominator*right.denominator);
}
*/

int main(int argc, char *argv[])
{
	Rational<int> half(1, 2);
	Rational<int> result = half * half;
	Rational<int> result2 = half * 2; 	//implicit type conversion functions are NEVER considered
						// during tempalte argument deduction
						// UPDATE: declaring it friend (not a template anymore) solved this
	Rational<int> result3 = 2 * half;
	return 0;
}
